<?php
/**
 * Created by PhpStorm.
 * User: DELL
 * Date: 2018/7/14
 * Time: 12:27
 */

namespace app\api\controller\v1;
use app\api\controller\Common;
use app\common\lib\Aes;
use app\common\lib\exception\ApiException;

class Rank extends Common
{
    /**
     * 获取排行榜新闻数据
     * 1.根据用户阅读量排序来获取 5-10条
     * 2.当阅读量大的时候,优化,可以用redis
     * @return ApiException|array
     */
    public function index()
    {
        try{
            $ranks = model('news')->getRankNormalNews();
            $ranks = $this->getDealNews($ranks);
        }catch (\Exception $e){
            return new ApiException('error',400);
        }
        return show(1,'ok',$ranks,200);
    }
}